package com.example.viewtext01;

import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.viewtext01.view.HeaderView;

public class SecondActivity extends AppCompatActivity {
    protected HeaderView mHeaderView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        mHeaderView = findViewById(R.id.header_view);
        mHeaderView.setTitle("第二页Title");
        mHeaderView.setLeftText("返回");
        mHeaderView.setRightText("搜索");
        mHeaderView.setLeftClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        mHeaderView.setRightClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(SecondActivity.this, "搜索", Toast.LENGTH_LONG).show();
            }
        });
        mHeaderView.setRightVisibility(View.GONE);
        mHeaderView.setLeftBackgroundColor(0xFFFF0000);
    }
}
